import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const state = {
  activityId: "", //当前专场项目ID  this.$store.state.activityId
  activeTop: '1', // 顶部导航选中
  leftNav: 'ticketList',
  ticketList: [], //门票的数据  this.$store.state.ticketList
  refundList: [], //退款信息  this.$store.state.refundList
  allTableData: [], //门票的数据  this.$store.state.allTableData
  protocolList: [], //协议的数据  this.$store.state.protocolList
  foruList: [], //论坛管理表格list this.$store.state.foruList
  priceList: [], //价格组数据 this.$store.state.priceList
  shareList: [], //分享列表 this.$store.state.shareList
  fieldList: [], //字段管理 this.$store.state.fieldList
  powerManageList: [], //会务活动表格数据 this.$store.state.powerManageList
  bannerUrl: "", //页面设置banner
  ticketDescription: "", //,设置门票说明
  groupTicketNumDescription: "", //设置团购票数量说明
  resignationChangeNoticeContent: "", //设置退改签须知
  customerServiceTel: "" //客服电话
}

const getters = {
  activityId: state => state.activityId,
  activeTop: state => state.activeTop,
  leftNav: state => state.leftNav,
  bannerUrl: state => state.bannerUrl,
  ticketDescription: state => state.ticketDescription,
  groupTicketNumDescription: state => state.groupTicketNumDescription,
  resignationChangeNoticeContent: state => state.resignationChangeNoticeContent,
  customerServiceTel: state => state.customerServiceTel
}


const mutations = {
  'SET_ACTIVITY_ID': (state, activityId) => {
    state.activityId = activityId;
  },
  'SET_ACTIVE_TOP': (state, activeTop) => {
    state.activeTop = activeTop;
  },
  'SET_LEFT_NAV': (state, leftNav) => {
    state.leftNav = leftNav;
  },
  'SET_BANNER_URL': (state, bannerUrl) => {
    state.bannerUrl = bannerUrl;
  },
  'SET_TICKET_DESCRIPTION': (state, ticketDescription) => {
    state.ticketDescription = ticketDescription;
  },
  'SET_GROUP_TICKET_NUM_DESCRIPTIO': (state, groupTicketNumDescription) => {
    state.groupTicketNumDescription = groupTicketNumDescription;
  },
  'SET_RESIGNATION_CHANGE_NOTICE_CONTENT': (state, resignationChangeNoticeContent) => {
    state.resignationChangeNoticeContent = resignationChangeNoticeContent;
  },
  'SET_CUSTOMER_SERVICE_TEL': (state, customerServiceTel) => {
    state.customerServiceTel = customerServiceTel;
  },
}

const actions = {
  setActivityId: ({
    commit
  }, activityId) => {
    return commit('SET_ACTIVITY_ID', activityId)
  },
  setActiveTop: ({
    commit
  }, activeTop) => {
    return commit('SET_ACTIVE_TOP', activeTop)
  },
  setLeftNav: ({
    commit
  }, leftNav) => {
    return commit('SET_LEFT_NAV', leftNav)
  },

  setBannerUrl: ({
    commit
  }, bannerUrl) => {
    return commit('SET_BANNER_URL', bannerUrl)
  },
  setTicketDescription: ({
    commit
  }, ticketDescription) => {
    return commit('SET_TICKET_DESCRIPTION', ticketDescription)
  },
  setGroupTicketNumDescription: ({
    commit
  }, groupTicketNumDescription) => {
    return commit('SET_GROUP_TICKET_NUM_DESCRIPTIO', groupTicketNumDescription)
  },
  setResignationChangeNoticeContent: ({
    commit
  }, resignationChangeNoticeContent) => {
    return commit('SET_RESIGNATION_CHANGE_NOTICE_CONTENT', resignationChangeNoticeContent)
  },
  setCustomerServiceTel: ({
    commit
  }, customerServiceTel) => {
    return commit('SET_CUSTOMER_SERVICE_TEL', customerServiceTel)
  }
}

export default new Vuex.Store({
  state,
  getters,
  mutations,
  actions
});
